package com.example.menu;

public class Time {
		public long startTime_s;
		public long currentTime_s;
		public long nextTime_s;
		public long elapsedTime_s;
		
		public Time () {
			startTime_s = System.currentTimeMillis()/1000;
			currentTime_s = startTime_s;
			nextTime_s = startTime_s;
			calcNext ();
		}
		
        public boolean update () {
            if (nextTime_s > currentTime_s) {
                currentTime_s = System.currentTimeMillis()/1000;
                elapsedTime_s = startTime_s - currentTime_s;

                return true;
            }
            else {
                return false;
            }
        }
		
		// We can make this a more robust function based on difference in timestamp/how long the game has been going on...
		public void calcNext () {
			assert (nextTime_s <= currentTime_s);
			nextTime_s = currentTime_s + 10000;
		}
		
		// is it time to change a button yet? called in the WAIT stage of the game loop
		public boolean check () {
			if (nextTime_s > currentTime_s) return false;
			else return true;
		}
}
